/**
 * @brief    
 * 
 * @version  0.1
 * @author   yuanchenxi
 * @date     2025.03.17
 *         _
 *     ___| |__   ___ _ __   __ _  ___  _ __   __ _
 *    / __| '_ \ / _ \ '_ \ / _` |/ _ \| '_ \ / _` |
 *    \__ \ | | |  __/ | | | (_| | (_) | | | | (_| |
 *    |___/_| |_|\___|_| |_|\__, |\___/|_| |_|\__, |
 *                          |___/             |___/
 * @copyright (c) 2025 by 神工仿真, All Rights Reserved.
 */
#include "gtest/gtest.h"

#include "DataStructure/Input/Table/TABLED1Data.h"
#include "DataStructure/Common/Constant.h"

using namespace SG::DataStructure::FEM;
using SG::Algebra::Point;
using SG::Algebra::Vector3D;
using SG::DataStructure::Common::Real;
using SG::DataStructure::FEM::TABLED1Data;
using SG::DataStructure::Common::TOLERANCE;

class TABLED1DataTest : public ::testing::Test
{
  public:
    virtual void SetUp () override
    {
        data.m_XYList.push_back ({10.0, 10.0});
        data.m_XYList.push_back ({100.0, 100.0});
    }
    TABLED1Data data;
};

TEST_F (TABLED1DataTest, TABLED1DataInterpolateTest)
{
    ASSERT_NEAR(data.Interpolate (50.0), 50.0, TOLERANCE);
}

TEST_F (TABLED1DataTest, TABLED1DataInterpolateLogLinearTest)
{
    data.m_CODEX = 1;
    ASSERT_NEAR(data.Interpolate (31.6227766), 55.0, TOLERANCE);
}

TEST_F (TABLED1DataTest, TABLED1DataInterpolateLogLogTest)
{
    data.m_CODEY = 1;
    ASSERT_NEAR(data.Interpolate (55.0), 31.6227766, TOLERANCE);
}

TEST_F (TABLED1DataTest, TABLED1DataInterpolateLinearLogTest)
{
    data.m_CODEX = 0;
    ASSERT_NEAR(data.Interpolate (55.0), 55.0, TOLERANCE);
}


